<!doctype  html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::sources(title='用户管理')"></head>
<body>
	<!-- 头部 -->
	<div th:include="components/header::navbar"></div>
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<a class="menu-toggler" id="menu-toggler" href="#"> <span
				class="menu-text"></span>
			</a>
			<!-- 菜单 -->
			<div th:substituteby="components/leftbar::sidebar"></div>
			<!-- 主页面 -->
			<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i> <a href="#">首页</a></li>
						<li>基本信息管理</li>
						<li class="active">会话管理</li>
					</ul>
					<!-- .breadcrumb -->
				</div>
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<h3 class="header smaller lighter blue">会话管理</h3>
							<div class="table-header">会话列表    当前在线<span th:text="${sessionCount}"></span>人</div>
							<div class="table-responsive">
								<table id="accountList"
									class="table table-striped table-bordered table-hover">
									<thead>
										<tr>
											<th class="center"><label> <input
													type="checkbox" class="ace" /> <span class="lbl"></span>
											</label></th>
											<th class="center">会话ID</th>
											<th class="center">用户名</th>
											<th class="center">主机地址</th>
											<th class="center">最后访问时间</th>
											<th class="center">已强制退出</th>
											<th class="center">操作</th>
										</tr>
									</thead>
									<tbody>
										<tr
											th:if="${sessions != null and  sessionCount > 0}"
											th:each="item:${sessions}">
											<td class="center"><label> <input
													type="checkbox" class="ace" /> <span class="lbl"></span>
											</label></td>
											<td th:text="${item.id}">session ID</td>
											<td th:text="${T(com.rainbow.bam.util.Functions).principal(item)}">User Name</td>
											<td th:text="${item.host}">HOST</td>
											<td th:text="${item.lastAccessTime}">Last Time</td>
											<td th:if="${T(com.rainbow.bam.util.Functions).isForceLogout(item)}">
											是
											</td>
											<td th:if="${!T(com.rainbow.bam.util.Functions).isForceLogout(item)}">
											否
											</td>
											<td>
												<div th:if="${!T(com.rainbow.bam.util.Functions).isForceLogout(item)}"
													class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
													<a class="blue" th:href="@{${domain}+'/sessions/'+${session.id}+'/forceLogout'}">强制退出
													</a>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
					<div
						th:substituteby="components/pagination::pagination(pagination=${paginationResponse},action=${domain}+'/sessions/sessionslist')"></div>
				</div>
			</div>
		</div>
	</div>
	<!-- js 资源 -->
	<div th:include="components/footer::basescript"></div>
	<script th:inline="javascript">
		/*<![CDATA[*/
		jQuery(function($) {
			$('table th input:checkbox').on(
					'click',
					function() {
						var that = this;
						$(this).closest('table').find(
								'tr > td:first-child input:checkbox').each(
								function() {
									this.checked = that.checked;
									$(this).closest('tr').toggleClass(
											'selected');
								});
					});
			$('[data-rel="tooltip"]').tooltip({
				placement : tooltip_placement
			});
			function tooltip_placement(context, source) {
				var $source = $(source);
				var $parent = $source.closest('table')
				var off1 = $parent.offset();
				var w1 = $parent.width();
				var off2 = $source.offset();
				var w2 = $source.width();
				if (parseInt(off2.left) < parseInt(off1.left)
						+ parseInt(w1 / 2))
					return 'right';
				return 'left';
			}
		})
		/*]]>*/
	</script>
</body>
</html>